"use strict";
var app=new Vue({
    el:"#app",
    data:{
        userId:1,
        list:[
            {id:1,name:"印厂信息"},
            {id:2,name:"设备"},
            {id:3,name:"招聘"},
            {id:4,name:"供应"},
            {id:5,name:"求购"},
            // {id:7,name:"心情"},
            {id:8,name:"二手"}
        ],
        is_enterprise:""
    },
    created:function(){
        if(FastClick.attach(document.body),""!=$.getPara("userId")){
            var e=$.getPara("userId");this.userId=e,$.setStorage("userId",e)
        }else if($.getStorage("userId")&&""!=$.getStorage("userId")){
            e=parseInt($.getStorage("userId"));this.userId=e}
            this.getEnterprise()
        },
    methods:{
        getEnterprise:function(){
            var i=this,e=i.userId;
            $.ajax({
                url:"/api/user/info",
                type:"get",
                data:{userId:e},
                dataType:"json",
                success:function(e){
                    if(200==e.code){
                        e=e.data;i.is_enterprise=e.is_enterprise
                    }
                }
            })
        },
        urlHref:function(e){
            if(1==e.id)(i={title:"我要发布-印厂信息",type:"mePublish"}).url="/mePublish/mePrinting.html?id="+e.id,0<this.userId&&(i.url="/mePublish/mePrinting.html?id="+e.id+"&userId="+this.userId);
            else if(2==e.id){(i={title:"我要发布-设备",type:"mePublish"}).url="/mePublish/meEquipment.html?id="+e.id,0<this.userId&&(i.url="/mePublish/meEquipment.html?id="+e.id+"&userId="+this.userId)}
            else if(3==e.id){if(0==this.is_enterprise)return $.toast("您还不是企业用户，不能发布招聘","text"),!1;1==this.is_enterprise&&((i={title:"我要发布-招聘",type:"mePublish"}).url="/mePublish/mePosition.html?id="+e.id,0<this.userId&&(i.url="/mePublish/mePosition.html?id="+e.id+"&userId="+this.userId))}
            else if(4==e.id){(i={title:"我要发布-供应",type:"mePublish"}).url="/mePublish/meProvision.html?id="+e.id,0<this.userId&&(i.url="/mePublish/meProvision.html?id="+e.id+"&userId="+this.userId)}
            else if(5==e.id){(i={title:"我要发布-求购",type:"mePublish"}).url="/mePublish/meBuy.html?id="+e.id,0<this.userId&&(i.url="/mePublish/meBuy.html?id="+e.id+"&userId="+this.userId)}
            else if(7==e.id){(i={title:"我要发布-心情",type:"mePublish"}).url="/mePublish/meHumor.html?id="+e.id,0<this.userId&&(i.url="/mePublish/meHumor.html?id="+e.id+"&userId="+this.userId)}
            else if(8==e.id){var i;(i={title:"我要发布-二手",type:"mePublish"}).url="/mePublish/meSecondhand.html?id="+e.id,0<this.userId&&(i.url="/mePublish/meSecondhand.html?id="+e.id+"&userId="+this.userId)}/(Android)/i.test(navigator.userAgent)?jsAndroid.appPush(JSON.stringify(i)):/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?window.webkit.messageHandlers.appPush.postMessage(i):window.location.href=i.url}
        }});